<template>
	<div>
		<el-card v-if="Isshow">
			<span>打卡签到</span><el-divider></el-divider>
			<template>
				<el-row>
				  <el-button type="primary" round @click="shang()">上班打卡</el-button>
				  <el-button type="success" round @click="xia()">下班打卡</el-button>
				</el-row>
			</template>
		</el-card>
	</div>
</template>
<script>
	export default{
		data(){
			return{
				formInline: {
					UserName: ''
				},
				tableData: [],
				page: 1,
				limit: 10,
				count: 0,
				Isshow:false
			}
		},	
		created(){
			this.show();
		},
		methods:{
			async shang(){
				const {
					data: res
				} = await this.$http.post('api/ZiXun/Add',{
       UserId:parseInt(window.sessionStorage.getItem("token")) 
     })
				if (res.code == 0) {
					this.$message.success(res.msg);
				}else{
					this.$message.error(res.msg)
				}
			},
			async show(){
							const {
								data: res
							} = await this.$http.post('api/ZiXun/GetRole',{
			  Id:parseInt(window.sessionStorage.getItem("token")) 
			})
							if (res.code == 0) {
								this.Isshow=res.IsShow
							}else{
								this.Isshow=res.IsShow
							}
						},
			async xia(){
				const {
									data: res
								} = await this.$http.post('api/ZiXun/Add2',{
				  UserId:parseInt(window.sessionStorage.getItem("token")) 
				})
								if (res.code == 0) {
									this.$message.success(res.msg);
								}else{
									this.$message.error(res.msg)
								}
			}
		}
	}
</script>

<style>·
	.el-tag{
		margin: 7px;
	}
	.bdtop{
		border-top: 1px solid #EEEEEE;
	}
	.bdbuttom{
		border-bottom: 1px solid #EEEEEE;
	}
	.vcenter{
		display: flex;
		align-items: center;
	}
</style>
